<?php /*!

@page tutorial Quickstart

@section toc Table of Contents

 - @subpage installation
 - @subpage folders
 - @subpage pipeline

Learn how to use rpd in this short tutorial.


*/ /* ----------------------------------------------------------------- */ /*!

\page installation What do I need?

\section install_sec Installation
\subsection step1 Step 1: Download your copy of rpd

Visit http://code.google.com/p/rpd/downloads and download the latest version
of rpd.

\subsection step2 Step 2: Upload rpd

Connect to your FTP and upload the whole files where you want.

\subsection step3 Step 3: Done

Thank you for using rpd Framework. We hope you enjoy it an write new
applications faster than ever.

*/ /* ----------------------------------------------------------------- */ /*!

\page folders Adding sites
\section folders Overview

- app
  - Model (used for MVC)
    - define new models for getting data here
  - View (used for MVC)
    - define the design for new sites here, where index.php goes as first page
  - Controller (used for MVC)
    - define the action for new sites here
- rpd (the framework itself)

@section add Adding sites

In general there are two ways to show sites:
 -# just send content
 -# evaluate input
 -# combined

The first way is the easiest because you only have to put a file in the
"app/View" folder. Also the evaluation just needs a file within
"app/Controller, but the third way needs both and can merge them (using MVC).

@subsection view View sites

For example the file "/app/View/index.php":

\content{/app/View/index.php,
<html>
	<body>
		Hello World!

		<form method="post" action="World">
		I am <input name="username" />
		<input type="submit" />
		</form>
	</body>
</html>
}

The output will be a simple form. Run your server and call the URL where "rpd"
is located.

<pre>Output "/"</pre>
@verbatim Hello World!
I am __________ [submit-button] @endverbatim

@subsection controller Controll sites

Now we receive the data in "app/Controller/world/world.php" and react to it.
It's important that every file and folder after "app/Controller" is in
lower-case.

\content{/app/Controller/world/world.php,
<?php

echo "Hello " . $_POST["username"];

?>
}

This is how you devide your site in PHP and (X)HTML / XML to have a better
overview and enhance your development. With (well known) MVC designer and
programmer are able to work simultaneously at the same page. Now type some
name in the form, send it and look at the output.

@subsection combine Controller and View together

As you might noticed this it not clean HTML so far. So let us merge
the two ways together to get valid HTML and create a new View:

\content{/app/View/world/world.php,
<html>
	<body>
		Hello <?=$username?> !
	</body>
</html>
}

Here you can see that we placed a wildcard named "username" which can be
filled with information. This is what we want to do now as we edit the last
Controller:

\content{/app/Controller/world/world.php,
<?php

// get the just generated view for "world"
$view = new View("world/world");	// the extension .php is not needed here

// fill some data
$view->username = $_POST["username"];

// show it
echo $view;

?>
}
\nomagic{	This will also work to "fill some data":,
			$view->set("username"\, $_POST["username"]);
}

But it can be done much easier. @ref pipeline "Read on the next site."

*/ /* ----------------------------------------------------------------- */ /*!

\page pipeline Develop fast

According to the example from the last page ("Structure") you can pipe the
given POST into the view:

\content{/app/Controller/world/world.php,
<?php

$view = new View();		// will get the according view named like the controller
echo $view($_POST);		// pipe the given $_POST fields into view and show it

?>
}

\nomagic{	This will do the same:,
			echo $view->pipe($_POST);
}

Any kind of information can be shortly pipe to the placeholders in the view
like that.

<em class="note">PHP 5.3 and above is needed. Below that you'll have to use
the alias "$view->pipe($_POST);". See View::pipe() for more information.</em>

Data can be pushed in many classes which implements the Pipeline interface.
Look up the Pipeline-Interface and expand the inheritance diagram to know
which classes can pipeline.

*/ /* ----------------------------------------------------------------- */ ?>